package com.yang.struct;

public class ForDemo02 {
    public static void main(String[] args) {
        //练习1 ：计算0-100 之间的奇数和偶数的和

        int oddSum = 0;
        int evenSum = 0;

        for (int i = 0; i <= 100; i++) {
            if (i % 2 != 0) {
                oddSum += i;//oddSum = oddSum + i;
            }else  {
                evenSum += i;
            }
        }
        System.out.println("oddSum=" + oddSum);
        System.out.println("evenSum=" + evenSum);
    }
}
